package com.example.vnfood;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

public class VnFood extends TabActivity {

	private static final String FOODLIST_TITLE = "FoodList";
	private static final String FAVORITE_TITLE = "Favorite";
	private static final String ABOUT_TITLE = "About";
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_vn_food);
		
		TabHost tabHost = getTabHost();
		
		// Food list tab
		TabSpec foodListTab = tabHost.newTabSpec(FOODLIST_TITLE);
		foodListTab.setIndicator(FOODLIST_TITLE,getResources().getDrawable(R.drawable.foodlist));
		Intent foodListIntent = new Intent(this, FoodListActivity.class);
		foodListTab.setContent(foodListIntent);
		
		// Favorite tab
		TabSpec favoriteTab = tabHost.newTabSpec(FAVORITE_TITLE);
		favoriteTab.setIndicator(FAVORITE_TITLE, getResources().getDrawable(R.drawable.favorite));
		Intent favoriteIntent = new Intent(this, FavoriteActivity.class);
		favoriteTab.setContent(favoriteIntent);
		
		// About list tab
		TabSpec aboutTab = tabHost.newTabSpec(ABOUT_TITLE);
		aboutTab.setIndicator(ABOUT_TITLE, getResources().getDrawable(R.drawable.about));
		Intent aboutIntent = new Intent(this, AboutActivity.class);
		aboutTab.setContent(aboutIntent);
		
		// Adding all TabSpec to TabHost
		tabHost.addTab(foodListTab);
		tabHost.addTab(favoriteTab);
		tabHost.addTab(aboutTab);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_vn_food, menu);
		return true;
	}

}
